home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 62
/
Volume 62 - JOGO DISK .iso
/
Games
/
penguin_dinner.swf
/
scripts
/
__Packages
/
classes
/
ui
/
TextButton.as
< prev
next >
Wrap
Text File
|
2008-03-17
|
4KB
|
131 lines
class classes.ui.TextButton extends classes.ui.AbstractWidget
{
var upStateColor = 0;
var overStateColor = 16777215;
var pulsingCount = 0;
static var CLICK = "click";
static var ROLL_OVER = "roll_over";
static var ROLL_OUT = "roll_out";
function TextButton()
{
super();
if(this.initAppearStyle != "none")
{
this._visible = false;
var _loc5_ = this._x;
var _loc4_ = this._y;
switch(this.initAppearStyle)
{
case "top":
this._y = -50;
break;
case "bottom":
this._y = 450;
break;
case "left":
this._x = -50;
break;
case "right":
this._x = 650;
}
var _loc3_ = com.potapenko.managers.Conv.create();
_loc3_.addPause(String(this.initAppearDelay));
_loc3_.put(this,"_visible",0,true);
_loc3_.anim(this,{_x:_loc5_,_y:_loc4_},{speed:5,to_end:true,scale:false,delta:null,duration:null,notSwap:true,frame_value:"1",easing:mx.transitions.easing.Elastic.easeOut});
}
if(this.pulsing)
{
this.startLocalLoop(this.update);
}
}
function update()
{
var _loc3_ = 1.4 + 0.4 * Math.sin(this.pulsingCount);
this.pulsingCount += 0.2;
var _loc2_ = new Array();
_loc2_ = _loc2_.concat([_loc3_,0,0,0,0]);
_loc2_ = _loc2_.concat([0,_loc3_,0,0,0]);
_loc2_ = _loc2_.concat([0,0,_loc3_,0,0]);
_loc2_ = _loc2_.concat([0,0,0,1,0]);
this.filters = [new flash.filters.ColorMatrixFilter(_loc2_)];
}
function lock()
{
this.labelField.textColor = this.upStateColor;
super.lock();
}
function set label($label)
{
this.labelField.text = $label;
}
function get label()
{
return this.labelField.text;
}
function set upColor($color)
{
this.upStateColor = $color;
this.labelField.textColor = this.upStateColor;
}
function set overColor($color)
{
this.overStateColor = $color;
}
function set align($align)
{
this.labelField.autoSize = $align;
}
function set appearStyle($appearStyle)
{
this.initAppearStyle = $appearStyle;
}
function set appearDelay($delay)
{
this.initAppearDelay = $delay;
}
function set isPulsing($pulsing)
{
this.pulsing = $pulsing;
}
function onRollOver()
{
if(this.locked)
{
return undefined;
}
this.labelField.textColor = this.overStateColor;
this.dispatchEvent(new classes.events.WidgetEvent(this,classes.ui.TextButton.ROLL_OVER));
}
function onRelease()
{
if(this.locked)
{
return undefined;
}
classes.core.SoundManager.getInstance().startSound("click_game_object");
this.deactivate();
this.dispatchEvent(new classes.events.WidgetEvent(this,classes.ui.TextButton.CLICK));
}
function onRollOut()
{
this.deactivate();
}
function onDragOut()
{
this.deactivate();
}
function onReleaseOutside()
{
this.deactivate();
}
function deactivate()
{
if(this.locked)
{
return undefined;
}
this.labelField.textColor = this.upStateColor;
this.dispatchEvent(new classes.events.WidgetEvent(this,classes.ui.TextButton.ROLL_OUT));
}
}